# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         text11
# Description: 例23.11
# Author:       ASUS
# Date:         2019/4/7
#-------------------------------------------------------------------------------


from numpy import *
a1 = arange(20).reshape(4,5)
print(a1)
#savetxt将数组保存成CSV文件,用逗号分隔
savetxt("a1.txt",a1,fmt="%d",delimiter=",")
print("--------------------------")
#只获取2，4，5列的数据
b = loadtxt("a1.txt",dtype="int",delimiter=",",usecols={1,3,4})
print(b)
print("-----------------------")
#分别返回2,5列
x,y = loadtxt("a1.txt",dtype="int",delimiter=",",usecols=(1,4),unpack=True)
print(x)
print(y)

